import http from "@/utils/request"
import { UserInfo, UserListResponse, UserParams, UserTypeListResponse } from "./type";

export const  getUserinfoList=(params:UserParams)=>{

    return  http.get<UserListResponse,UserParams>("userinfo/list",params);
}

/**
 * 获取居民类型
 * 
 */

export const getUserinfoType=()=>{
    return http.get<UserTypeListResponse>("userinfotype/list");
}

/**
 * 添加居民
 * 
 */

export const addUserinfo=(data:UserInfo)=>{
    return http.post<UserInfo,UserInfo>("userinfo/add",data);
}

/**
 * 根据id获取居民信息
 * 
 */
export const getUserinfoById=(id:number)=>{

    console.log("11111111111",id);
    
    return http.get<UserInfo>("userinfo/get",{id});
}

/**
 * 删除居民
 */
export const deleteUserById=(id:number)=>{
    return http.get<any>("userinfo/delete",{id});
}

/**
 * 批量删除居民
 */
export const deleteUserByIds=(ids:number[])=>{
    return http.post<any>("userinfo/deleteall",{ids});
}